import {createRouter, createWebHashHistory} from 'vue-router'

const router = createRouter({
    moder: 'hash',
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            name: '默认路径',
            redirect: '/main'
        },
        {
            path: '/main',
            name: '主页面',
            component: () => import('../views/MainPage.vue'),
            redirect: '/welcome',
            children: [
                {
                    path: '/welcome',
                    name: '欢迎界面',
                    component: () => import('../views/welcomeView.vue')
                },
                {
                    path: '/scheduled-task',
                    name: '定时任务',
                    component: () => import('../views/ScheduledTasks.vue'),
                    redirect: '/operation-report',
                    children: [
                        {
                            path: '/operation-report',
                            name: '运行报表',
                            component: () => import('../views/scheduled/OperationReport.vue')
                        },
                        {
                            path: '/task-management',
                            name: '任务管理',
                            component: () => import('../views/scheduled/TaskManagement.vue'),
                            children: [
                                {
                                    path: '/task-detail/:taskId',
                                    name: '任务详情',
                                    component: () => import('../views/scheduled/TaskDetail.vue'),
                                    props: true // 允许通过路由传递 props
                                },
                                {
                                    path: '/log-detail/:id',
                                    name: '调度日志详情',
                                    component: () => import('../views/scheduled/LogDetail.vue'),
                                    props: true
                                }
                            ]
                        },
                        {
                            path: '/task-log/:taskId',
                            name: '调度日志',
                            component: () => import('../views/scheduled/TaskLog.vue'),
                            props: true

                        },
                        {
                            path: '/actuator-management',
                            name: '执行器管理',
                            component: () => import('../views/scheduled/ActuatorManagement.vue')
                        },
                        {
                            path: '/user-management',
                            name: '用户管理',
                            component: () => import('../views/UserManagement.vue')
                        },
                    ]


                }
            ]
        },
        {
            path: '/login',
            name: '登录页面',
            component: () => import('../views/LoginView.vue')
        },
        {
            path: '/about',
            name: '关于我们页面',
            component: () => import('../views/AboutView.vue'),
        }
    ]
})

export default router
